home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 May / SGI IRIX 6.5 Complementary Applications 2004 May.iso / dist / PPRO.idb / usr / include / cups / raster.h.z / raster.h
Encoding:
C/C++ Source or Header  |  2004-01-20  |  9.0 KB  |  264 lines

  1. /*
  2.  * "$Id: raster.h,v 1.7 2002/12/17 18:59:29 swdev Exp $"
  3.  *
  4.  *   Raster file definitions for the Common UNIX Printing System (CUPS).
  5.  *
  6.  *   Copyright 1997-2003 by Easy Software Products.
  7.  *
  8.  *   These coded instructions, statements, and computer programs are the
  9.  *   property of Easy Software Products and are protected by Federal
  10.  *   copyright law.  Distribution and use rights for the CUPS Raster source
  11.  *   files are outlined in the GNU Library General Public License, located
  12.  *   in the "pstoraster" directory.  If this file is missing or damaged
  13.  *   please contact Easy Software Products at:
  14.  *
  15.  *       Attn: CUPS Licensing Information
  16.  *       Easy Software Products
  17.  *       44141 Airport View Drive, Suite 204
  18.  *       Hollywood, Maryland 20636-3111 USA
  19.  *
  20.  *       Voice: (301) 373-9603
  21.  *       EMail: cups-info@cups.org
  22.  *         WWW: http://www.cups.org
  23.  *
  24.  *   This code and any derivative of it may be used and distributed
  25.  *   freely under the terms of the GNU General Public License when
  26.  *   used with GNU Ghostscript or its derivatives.  Use of the code
  27.  *   (or any derivative of it) with software other than GNU
  28.  *   GhostScript (or its derivatives) is governed by the CUPS license
  29.  *   agreement.
  30.  *
  31.  *   This file is subject to the Apple OS-Developed Software exception.
  32.  */
  33.  
  34. #ifndef _CUPS_RASTER_H_
  35. #  define _CUPS_RASTER_H_
  36.  
  37. #  ifdef __cplusplus
  38. extern "C" {
  39. #  endif /* __cplusplus */
  40.  
  41. /*
  42.  * Every non-PostScript printer driver that supports raster images should
  43.  * use the application/vnd.cups-raster image file format.  Since both the
  44.  * PostScript RIP (pstoraster, based on GNU Ghostscript) and Image RIP
  45.  * (imagetoraster, located in the filter directory) use it, using this format
  46.  * saves you a lot of work.  Also, the PostScript RIP passes any printer
  47.  * options that are in a PS file to your driver this way as well...
  48.  */
  49.  
  50. /*
  51.  * Constants...
  52.  */
  53.  
  54. #  define CUPS_RASTER_SYNC    0x52615374    /* RaSt */
  55. #  define CUPS_RASTER_REVSYNC    0x74536152    /* tSaR */
  56.  
  57.  
  58. /*
  59.  * The following definition can be used to determine if the
  60.  * colorimetric colorspaces (CIEXYZ, CIELAB, and ICCn) are
  61.  * defined...
  62.  */
  63.  
  64. #  define CUPS_RASTER_HAVE_COLORIMETRIC 1
  65.  
  66.  
  67. /*
  68.  * Types...
  69.  */
  70.  
  71. typedef enum
  72. {
  73.   CUPS_RASTER_READ,            /* Open stream for reading */
  74.   CUPS_RASTER_WRITE            /* Open stream for writing */
  75. } cups_mode_t;
  76.  
  77. typedef enum
  78. {
  79.   CUPS_FALSE,                /* Logical false */
  80.   CUPS_TRUE                /* Logical true */
  81. } cups_bool_t;
  82.  
  83. typedef enum
  84. {
  85.   CUPS_JOG_NONE,            /* Never move pages */
  86.   CUPS_JOG_FILE,            /* Move pages after this file */
  87.   CUPS_JOG_JOB,                /* Move pages after this job */
  88.   CUPS_JOG_SET                /* Move pages after this set */
  89. } cups_jog_t;
  90.  
  91. typedef enum
  92. {
  93.   CUPS_ORIENT_0,            /* Don't rotate the page */
  94.   CUPS_ORIENT_90,            /* Rotate the page counter-clockwise */
  95.   CUPS_ORIENT_180,            /* Turn the page upside down */
  96.   CUPS_ORIENT_270            /* Rotate the page clockwise */
  97. } cups_orient_t;
  98.  
  99. typedef enum
  100. {
  101.   CUPS_CUT_NONE,            /* Never cut the roll */
  102.   CUPS_CUT_FILE,            /* Cut the roll after this file */
  103.   CUPS_CUT_JOB,                /* Cut the roll after this job */
  104.   CUPS_CUT_SET,                /* Cut the roll after this set */
  105.   CUPS_CUT_PAGE                /* Cut the roll after this page */
  106. } cups_cut_t;
  107.  
  108. typedef enum
  109. {
  110.   CUPS_ADVANCE_NONE,            /* Never advance the roll */
  111.   CUPS_ADVANCE_FILE,            /* Advance the roll after this file */
  112.   CUPS_ADVANCE_JOB,            /* Advance the roll after this job */
  113.   CUPS_ADVANCE_SET,            /* Advance the roll after this set */
  114.   CUPS_ADVANCE_PAGE            /* Advance the roll after this page */
  115. } cups_adv_t;
  116.  
  117. typedef enum
  118. {
  119.   CUPS_EDGE_TOP,            /* Leading edge is the top of the page */
  120.   CUPS_EDGE_RIGHT,            /* Leading edge is the right of the page */
  121.   CUPS_EDGE_BOTTOM,            /* Leading edge is the bottom of the page */
  122.   CUPS_EDGE_LEFT            /* Leading edge is the left of the page */
  123. } cups_edge_t;
  124.  
  125. typedef enum
  126. {
  127.   CUPS_ORDER_CHUNKED,            /* CMYK CMYK CMYK ... */
  128.   CUPS_ORDER_BANDED,            /* CCC MMM YYY KKK ... */
  129.   CUPS_ORDER_PLANAR            /* CCC ... MMM ... YYY ... KKK ... */
  130. } cups_order_t;
  131.  
  132. typedef enum
  133. {
  134.   CUPS_CSPACE_W,            /* Luminance */
  135.   CUPS_CSPACE_RGB,            /* Red, green, blue */
  136.   CUPS_CSPACE_RGBA,            /* Red, green, blue, alpha */
  137.   CUPS_CSPACE_K,            /* Black */
  138.   CUPS_CSPACE_CMY,            /* Cyan, magenta, yellow */
  139.   CUPS_CSPACE_YMC,            /* Yellow, magenta, cyan */
  140.   CUPS_CSPACE_CMYK,            /* Cyan, magenta, yellow, black */
  141.   CUPS_CSPACE_YMCK,            /* Yellow, magenta, cyan, black */
  142.   CUPS_CSPACE_KCMY,            /* Black, cyan, magenta, yellow */
  143.   CUPS_CSPACE_KCMYcm,            /* Black, cyan, magenta, yellow, *
  144.                      * light-cyan, light-magenta     */
  145.   CUPS_CSPACE_GMCK,            /* Gold, magenta, yellow, black */
  146.   CUPS_CSPACE_GMCS,            /* Gold, magenta, yellow, silver */
  147.   CUPS_CSPACE_WHITE,            /* White ink (as black) */
  148.   CUPS_CSPACE_GOLD,            /* Gold foil */
  149.   CUPS_CSPACE_SILVER,            /* Silver foil */
  150.  
  151.   CUPS_CSPACE_CIEXYZ,            /* CIE XYZ */
  152.   CUPS_CSPACE_CIELab,            /* CIE Lab */
  153.  
  154.   CUPS_CSPACE_ICC1 = 32,        /* ICC-based, 1 color */
  155.   CUPS_CSPACE_ICC2,            /* ICC-based, 2 colors */
  156.   CUPS_CSPACE_ICC3,            /* ICC-based, 3 colors */
  157.   CUPS_CSPACE_ICC4,            /* ICC-based, 4 colors */
  158.   CUPS_CSPACE_ICC5,            /* ICC-based, 5 colors */
  159.   CUPS_CSPACE_ICC6,            /* ICC-based, 6 colors */
  160.   CUPS_CSPACE_ICC7,            /* ICC-based, 7 colors */
  161.   CUPS_CSPACE_ICC8,            /* ICC-based, 8 colors */
  162.   CUPS_CSPACE_ICC9,            /* ICC-based, 9 colors */
  163.   CUPS_CSPACE_ICCA,            /* ICC-based, 10 colors */
  164.   CUPS_CSPACE_ICCB,            /* ICC-based, 11 colors */
  165.   CUPS_CSPACE_ICCC,            /* ICC-based, 12 colors */
  166.   CUPS_CSPACE_ICCD,            /* ICC-based, 13 colors */
  167.   CUPS_CSPACE_ICCE,            /* ICC-based, 14 colors */
  168.   CUPS_CSPACE_ICCF            /* ICC-based, 15 colors */
  169. } cups_cspace_t;
  170.  
  171.  
  172. /*
  173.  * The page header structure contains the standard PostScript page device
  174.  * dictionary, along with some CUPS-specific parameters that are provided
  175.  * by the RIPs...
  176.  */
  177.  
  178. typedef struct
  179. {
  180.   /**** Standard Page Device Dictionary String Values ****/
  181.   char        MediaClass[64];        /* MediaClass string */
  182.   char        MediaColor[64];        /* MediaColor string */
  183.   char        MediaType[64];        /* MediaType string */
  184.   char        OutputType[64];        /* OutputType string */
  185.  
  186.   /**** Standard Page Device Dictionary Integer Values ****/
  187.   unsigned    AdvanceDistance;    /* AdvanceDistance value in points */
  188.   cups_adv_t    AdvanceMedia;        /* AdvanceMedia value (see above) */
  189.   cups_bool_t    Collate;        /* Collated copies value */
  190.   cups_cut_t    CutMedia;        /* CutMedia value (see above) */
  191.   cups_bool_t    Duplex;            /* Duplexed (double-sided) value */
  192.   unsigned    HWResolution[2];    /* Resolution in dots-per-inch */
  193.   unsigned    ImagingBoundingBox[4];    /* Pixel region that is painted (points) */
  194.   cups_bool_t    InsertSheet;        /* InsertSheet value */
  195.   cups_jog_t    Jog;            /* Jog value (see above) */
  196.   cups_edge_t    LeadingEdge;        /* LeadingEdge value (see above) */
  197.   unsigned    Margins[2];        /* Lower-lefthand margins in points */
  198.   cups_bool_t    ManualFeed;        /* ManualFeed value */
  199.   unsigned    MediaPosition;        /* MediaPosition value */
  200.   unsigned    MediaWeight;        /* MediaWeight value in grams/m^2 */
  201.   cups_bool_t    MirrorPrint;        /* MirrorPrint value */
  202.   cups_bool_t    NegativePrint;        /* NegativePrint value */
  203.   unsigned    NumCopies;        /* Number of copies to produce */
  204.   cups_orient_t    Orientation;        /* Orientation value (see above) */
  205.   cups_bool_t    OutputFaceUp;        /* OutputFaceUp value */
  206.   unsigned    PageSize[2];        /* Width and length of page in points */
  207.   cups_bool_t    Separations;        /* Separations value */
  208.   cups_bool_t    TraySwitch;        /* TraySwitch value */
  209.   cups_bool_t    Tumble;            /* Tumble value */
  210.  
  211.   /**** CUPS Page Device Dictionary Values ****/
  212.   unsigned    cupsWidth;        /* Width of page image in pixels */
  213.   unsigned    cupsHeight;        /* Height of page image in pixels */
  214.   unsigned    cupsMediaType;        /* Media type code */
  215.   unsigned    cupsBitsPerColor;    /* Number of bits for each color */
  216.   unsigned    cupsBitsPerPixel;    /* Number of bits for each pixel */
  217.   unsigned    cupsBytesPerLine;    /* Number of bytes per line */
  218.   cups_order_t    cupsColorOrder;        /* Order of colors */
  219.   cups_cspace_t    cupsColorSpace;        /* True colorspace */
  220.   unsigned    cupsCompression;    /* Device compression to use */
  221.   unsigned    cupsRowCount;        /* Rows per band */
  222.   unsigned    cupsRowFeed;        /* Feed between bands */
  223.   unsigned    cupsRowStep;        /* Spacing between lines */
  224. } cups_page_header_t;
  225.  
  226.  
  227. /*
  228.  * The raster structure maintains information about a raster data
  229.  * stream...
  230.  */
  231.  
  232. typedef struct
  233. {
  234.   unsigned    sync;            /* Sync word from start of stream */
  235.   int        fd;            /* File descriptor */
  236.   cups_mode_t    mode;            /* Read/write mode */
  237. } cups_raster_t;
  238.  
  239.  
  240. /*
  241.  * Prototypes...
  242.  */
  243.  
  244. extern void        cupsRasterClose(cups_raster_t *r);
  245. extern cups_raster_t    *cupsRasterOpen(int fd, cups_mode_t mode);
  246. extern unsigned        cupsRasterReadHeader(cups_raster_t *r,
  247.                                  cups_page_header_t *h);
  248. extern unsigned        cupsRasterReadPixels(cups_raster_t *r,
  249.                                  unsigned char *p, unsigned len);
  250. extern unsigned        cupsRasterWriteHeader(cups_raster_t *r,
  251.                                   cups_page_header_t *h);
  252. extern unsigned        cupsRasterWritePixels(cups_raster_t *r,
  253.                                   unsigned char *p, unsigned len);
  254.  
  255. #  ifdef __cplusplus
  256. }
  257. #  endif /* __cplusplus */
  258.  
  259. #endif /* !_CUPS_RASTER_H_ */
  260.  
  261. /*
  262.  * End of "$Id: raster.h,v 1.7 2002/12/17 18:59:29 swdev Exp $".
  263.  */
  264.